Skip to content

Final security hardening and project stabilization - #1

Merged
beenish-majeed merged 26 commits into
mainfrom
security/comprehensive-audit
Nov 13, 2026
Merged

beenish-majeed merged 26 commits into
mainfrom
security/comprehensive-audit

Conversation

@beenish-majeed

Copy link
Copy Markdown
Owner

Comprehensive Security Audit, Stability Hardening & Production Release Readiness

Summary of Changes

  1. Authentication & Production Safety:

    • Enforce mandatory production checks in lifespan: refuses to boot if ALLOW_INSECURE_DEV=True, if API_KEY is missing or <16 chars, or if SESSION_SECRET uses insecure default placeholders.
    • Enforce constant-time comparison for API_KEY in �erify_api_key.
  2. Reverse Proxy Security & Rate Limiting:

    • Implemented src/utils/proxy.py with RFC 7239 compliant right-to-left proxy chain parsing, CIDR subnet matching, and IPv6 address parsing.
    • Removed automatic RFC 1918 trust: only explicitly configured proxies in TRUSTED_PROXIES are trusted.
    • Direct untrusted connections strictly ignore X-Forwarded-For, X-Real-IP, and Forwarded headers, binding rate limits directly to the remote socket IP.
    • Hardened is_request_https to verify immediate peer proxy before honoring forwarded proto headers.
  3. FFmpeg & Subprocess Hardening:

    • Universal application of -nostdin, -protocol_whitelist file,lavfi (and concat where demuxer scripts are required), and explicit execution timeouts across all 9 categories of FFmpeg, FFprobe, and QA commands.
    • Isolated tempfiles with deterministic cleanup.
  4. SSRF & Outbound Request Security:

    • Outbound HTTP requests in FileAIClient and FalAIVideoProvider utilize SafeHTTPTransport with socket-level IP interception blocking private (RFC 1918), loopback, link-local, and cloud metadata (169.254.169.254) addresses.
    • Strict non-empty download validation ( otal_bytes > 0) and sensitive key redaction in logging and exceptions.
  5. Dependency & Supply Chain Security:

    • pip-audit -r requirements.txt: 0 known vulnerabilities (updated Pillow>=13.0.0).

pm audit --production: 0 vulnerabilities across all production dependencies.

  • Pruned unused devDependencies (@axe-core/playwright, �xe-core, playwright), eliminating high-severity dev advisories.
  1. Automated Verification:
    • Backend pytest suite: 484 passed, 3 skipped, 0 failures (100% pass rate).
    • Frontend Vitest suite: 137 passed (29 test files), 0 failures (100% pass rate).
    • Frontend bundle: compiled cleanly via sc && vite build.
    • GitHub Actions CI: 100% green across both �ackend-test and rontend-check jobs.

All changes have been comprehensively tested and verified for release readiness.

@beenish-majeed
beenish-majeed merged commit 5b57d28 into main Nov 13, 2026
4 checks passed
@beenish-majeed
beenish-majeed deleted the security/comprehensive-audit branch November 13, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant